#pragma once

#include "Definitions.h"
//#include "Structures.h"

#define NUMCONSTBUFFS 3
#define NUMVERTBUFFS 4

class Renderable;
class View;

class DirectX11
{
	static DirectX11* instance;

	CComPtr<ID3D11Device> device;
	CComPtr<ID3D11RenderTargetView> rtv;
	CComPtr<ID3D11DepthStencilView> dsv;
	CComPtr<ID3D11DeviceContext> deviceContext;
	CComPtr<ID3D11DeviceContext> deferredContext;
	CComPtr<ID3D11CommandList> commandList;
	CComPtr<IDXGISwapChain> swapChain;

	D3D11_VIEWPORT viewport;

	//Arrays
	ID3D11Buffer* buffers[NUMVERTBUFFS];
	ID3D11Buffer* constantBuffers[NUMCONSTBUFFS];

	DirectX11(void);
	~DirectX11(void);
	DirectX11(const DirectX11&);
	DirectX11& operator=(const DirectX11&);
public:

	enum ConstBuffSlots {CB_OBJECT,CB_CAMERA,CB_LIGHT};

	static DirectX11* GetInstance();
	void DeleteInstance();

	bool Initialize(HWND hWnd);
	bool Shutdown();

	void Draw(Renderable* object,View* camera);

	ID3D11Device* GetDevice() {return device;}
	ID3D11DeviceContext* GetImmediateContext() {return deviceContext;}

	bool Render();

	void SetConstantBuffer(ID3D11Buffer** buffer,ConstBuffSlots slot);

};

